import request from '@/utils/request'
import qs from "qs"
export default {
    pageInfo(pageNum, pageSize) {
        var data = qs.stringify({ "pageNum": pageNum, "pageSize": pageSize })
        return request({
            url: '/api-goods/spec/specs',
            method: 'post',
            data
        })
    },
    //新增
    add(spec) {
        console.log(spec)
        var data = qs.stringify({ "id": spec.id, "name": spec.name, "options": spec.options, "templateId": spec.templateId, "seq": spec.seq })
        return request({
            url: '/api-goods/spec/spec',
            method: "post",
            data
        })

    },
    //修改
    updateById(spec) {
        var data = qs.stringify({ "id": spec.id, "name": spec.name, "options": spec.options, "templateId": spec.templateId, "seq": spec.seq })
        return request({
            url: '/api-goods/spec/spec',
            method: "put",
            data
        })

    },
    //删除
    deleteById(id) {
        return request({
            url: `/api-goods/spec/spec/${id}`,
            method: "delete"
        })
    },
    //根据id查询数据
    findById(id) {
        return request({
            url: `/api-goods/spec/spec/${id}`,
            method: "get"
        })
    },
    //根据模板id查询数据
    findByTemplateId(id) {
        return request({
            url: `/api-goods/spec/spec/temp/${id}`,
            method: "get"
        })
    },
    //批量删除
    removes(ids) {
        return request({
            url: `/api-goods/spec/spec/${id}`,
            method: "delete"
        })
    }

}